package edu.ua.Team_Industry;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Spinner;
import android.widget.Toast;


public class Filter_Handler extends Activity{
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.filter_view);
//        Spinner spinner = (Spinner) findViewById(R.id.spinner1);
//        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
//                this, R.array.date_array, android.R.layout.simple_spinner_item);
//        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//        spinner.setAdapter(adapter);
//        spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
        final CheckBox checkBox1 = (CheckBox) findViewById(R.id.checkBox1);
        final CheckBox checkBox2 = (CheckBox) findViewById(R.id.checkBox2);
        final CheckBox checkBox3 = (CheckBox) findViewById(R.id.checkBox3);
        final CheckBox checkBox4 = (CheckBox) findViewById(R.id.checkBox4);
        final CheckBox checkBox5 = (CheckBox) findViewById(R.id.checkBox5);
        
        final Button btn = (Button) findViewById(R.id.button1);
    	btn.setOnClickListener(new OnClickListener() {
    	    public void onClick(View v) {
    	    	
    	    	Intent myIntent = new Intent();
    	    	myIntent.putExtra("Check_1", checkBox1.isChecked());
    	    	myIntent.putExtra("Check_2", checkBox2.isChecked());
    	    	myIntent.putExtra("Check_3", checkBox3.isChecked());
    	    	myIntent.putExtra("Check_4", checkBox4.isChecked());
    	    	myIntent.putExtra("Check_5", checkBox5.isChecked());
    	    	
    	    	//myIntent.putExtra("URL", picURL);
    	    	//myIntent.putExtra("TAG_TYPE", tagType);
    	    	setResult(RESULT_OK, myIntent);
    			finish();
    	    }
    	});
    }
	public class MyOnItemSelectedListener implements OnItemSelectedListener {

	    public void onItemSelected(AdapterView<?> parent,
	        View view, int pos, long id) {
	      Toast.makeText(parent.getContext(), "This is the " +
	          parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
	    }

	    public void onNothingSelected(AdapterView parent) {
	      // Do nothing.
	    }
	}
}
